package com.heima.comment.feign;

import com.heima.comment.service.CommentService;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmCommentLikeDto;
import com.heima.model.wemedia.dtos.WmCommentListDto;
import com.heima.model.wemedia.dtos.WmCommentRepayDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class CommentFeign {

    @Autowired
    private CommentService commentService;

    /**
     * 远程获取文章评论详情
     * @param dto
     * @return
     */
    @PostMapping("/api/v1/comment/list")
    public ResponseResult getCommentList(@RequestBody WmCommentListDto dto, @RequestParam Integer apAuthorId){
        return commentService.getCommentList(dto,apAuthorId);
    }

    /**
     * 自媒体端作者回复评论
     * @param dto
     * @return
     */
    @PostMapping("/api/v1/comment/repay")
    public ResponseResult commentRepay(@RequestBody WmCommentRepayDto dto){
        return commentService.commentRepay(dto);
    }

    /**
     * 作者点赞/取消点赞
     * @param dto
     * @return
     */
    @PostMapping("/api/v1/comment/authorLike")
    public ResponseResult authorLike(@RequestBody WmCommentLikeDto dto){
        return commentService.authorLike(dto);
    }

}
